home *** CD-ROM | disk | FTP | other *** search
- /*
- File: UniversalHIDModule.h
-
- Contains: This describes the interface a higher level part of the OS uses
- to talk with a UniversalHIDModule, and the way to implement
- a UniversalHIDModule compliant HID module.
-
- */
- /* We are not USB specific, but we share many definitions with the USB spec*/
- #ifndef __UNIVERSALHIDMODULE__
- #define __UNIVERSALHIDMODULE__
-
- #ifndef __MACTYPES__
- #include <MacTypes.h>
- #endif
- #ifndef __USB__
- #include <USB.h>
- #endif
-
-
-
- #if PRAGMA_ONCE
- #pragma once
- #endif
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- #if PRAGMA_IMPORT
- #pragma import on
- #endif
-
- #if PRAGMA_STRUCT_ALIGN
- #pragma options align=mac68k
- #elif PRAGMA_STRUCT_PACKPUSH
- #pragma pack(push, 2)
- #elif PRAGMA_STRUCT_PACK
- #pragma pack(2)
- #endif
-
- typedef UInt32 UHIDModuleConnectionID;
- /* FunctionPtr to be called when inturrupt occurs*/
- typedef CALLBACK_API_C( void , UHIDInterruptProcPtr )(void *theData, UInt32 refcon);
- /* FunctionPtr definitions for UniversalHIDModule dispatch table*/
- typedef CALLBACK_API_C( OSStatus , UHIDGetDeviceInfoProcPtr )(UInt32 inInfoSelector, void *outInfo);
- typedef CALLBACK_API_C( OSStatus , UHIDGetHIDDescriptorProcPtr )(UInt32 inDescriptorType, UInt32 inDescriptorIndex, UInt32 *ioBufferSize, void *outBuffer);
- typedef CALLBACK_API_C( OSStatus , UHIDClaimDeviceProcPtr )(UHIDModuleConnectionID *outConnectionID, UInt32 reserved);
- typedef CALLBACK_API_C( OSStatus , UHIDReleaseDeviceProcPtr )(UHIDModuleConnectionID inConnectionID);
- typedef CALLBACK_API_C( OSStatus , UHIDInstallInterruptProcPtr )(UHIDModuleConnectionID inConnectionID, UHIDInterruptProcPtr inInterruptProc, UInt32 inRefcon);
- typedef CALLBACK_API_C( OSStatus , UHIDControlDeviceProcPtr )(UHIDModuleConnectionID inConnectionID, UInt32 inControlSelector, void *ioControlData);
-
- enum {
- kCurrentDispatchTableVersion = 5,
- kOldestCompatableDispatchTableVersion = 5
- };
-
- /*
- UHIDModuleDispatchTable is exported by the HIDModule's PEF container
- dispatchTableCurrentVersion is kCurrentDispatchTableVersion
- dispatchTableOldestVersion is kOldestCompatableDispatchTableVersion
- (the oldest built client using this API that this UHIDModule will work with)
- vendorID is who wrote this UniversalHIDModule (hi word of 0 and USB vendorID is valid)
- */
-
- struct UHIDModuleDispatchTableStruct {
- UInt16 dispatchTableCurrentVersion;
- UInt16 dispatchTableOldestVersion;
- UInt32 vendorID;
- UInt32 vendorSpecific;
- UInt32 reserved;
- UHIDGetDeviceInfoProcPtr pUHIDGetDeviceInfo;
- UHIDClaimDeviceProcPtr pUHIDClaimDevice;
- UHIDReleaseDeviceProcPtr pUHIDReleaseDevice;
- UHIDInstallInterruptProcPtr pUHIDInstallInterrupt;
- UHIDControlDeviceProcPtr pUHIDControlDevice;
- UHIDGetHIDDescriptorProcPtr pUHIDGetHIDDescriptor;
- };
- typedef struct UHIDModuleDispatchTableStruct UHIDModuleDispatchTableStruct;
-
- typedef UHIDModuleDispatchTableStruct UHIDModuleDispatchTable;
- typedef UHIDModuleDispatchTableStruct * UHIDModuleDispatchTablePtr;
- /* the prototypes for the actual functions in the UHIDModule follow*/
- EXTERN_API_C( OSStatus )
- UHIDGetDeviceInfo (UInt32 inInfoSelector,
- void * outInfo);
-
- EXTERN_API_C( OSStatus )
- UHIDGetHIDDescriptor (UInt32 inDescriptorType,
- UInt32 inDescriptorIndex,
- UInt32 * ioBufferSize,
- void * outBuffer);
-
- /* Claim and release are a way to insure that only one client is connected*/
- EXTERN_API_C( OSStatus )
- UHIDClaimDevice (UHIDModuleConnectionID * outConnectionID,
- UInt32 reserved);
-
- EXTERN_API_C( OSStatus )
- UHIDReleaseDevice (UHIDModuleConnectionID inConnectionID);
-
- EXTERN_API_C( OSStatus )
- UHIDInstallInterrupt (UHIDModuleConnectionID inConnectionID,
- UHIDInterruptProcPtr inInterruptProc,
- UInt32 inRefcon);
-
- EXTERN_API_C( OSStatus )
- UHIDControlDevice (UHIDModuleConnectionID inConnectionID,
- UInt32 inControlSelector,
- void * ioControlData);
-
- /* these are the constants to be passed to UHIDControlDevice*/
-
- enum {
- kUHIDRemoveInterruptHandle = 0,
- kUHIDVendorSpecificControlStart = 0x00010000
- };
-
- /* these are the constants to be passed to UHIDGetDeviceInfo*/
-
- enum {
- kUHIDGetVendorID = 0,
- kUHIDGetProductID = 1,
- kUHIDGetMaxPacketSize = 2,
- kUHIDVendorSpecificGetInfoStart = 0x00010000
- };
-
-
- #if PRAGMA_STRUCT_ALIGN
- #pragma options align=reset
- #elif PRAGMA_STRUCT_PACKPUSH
- #pragma pack(pop)
- #elif PRAGMA_STRUCT_PACK
- #pragma pack()
- #endif
-
- #ifdef PRAGMA_IMPORT_OFF
- #pragma import off
- #elif PRAGMA_IMPORT
- #pragma import reset
- #endif
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif /* __UNIVERSALHIDMODULE__ */
-
-